@extends('layouts.app')

@section('content')
    <div class="nav-title">
        <span class="fl">小区新增</span>
        <el-button class="fr"
                   @click="goBack"
                   size="mini"
                   type="primary"
                   style="margin-top: 4px;">返回</el-button>
    </div>
    <el-form label-width="60px" class="community-form">
        <el-form-item label="名称" required>
            <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="别称">
            <el-input v-model="form.second_name"></el-input>
        </el-form-item>
        <el-form-item label="均价">
            <el-input-number v-model="form.average_price"></el-input-number>
        </el-form-item>
        <el-form-item label="地址">
            <el-input v-model="form.address"></el-input>
        </el-form-item>
        <el-form-item label="描述">
            <div id="editor"></div>
        </el-form-item>
        <el-form-item label="图集">
            <el-upload
                    name="file"
                    multiple
                    :data="{_token: '{{csrf_token()}}'}"
                    action="/community/upload"
                    :on-success="function(r, f, l){return fileSuccess(r, f, l, 'pics')}"
                    :on-preview="filePreview"
                    :on-remove="function(f, l){return fileRemove(f, l, 'pics')}"
                    :file-list="form.pics"
                    :on-exceed="fileExceed"
                    list-type="picture">
                <el-button size="small" type="primary">点击上传</el-button>
                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过2M</div>
            </el-upload>
        </el-form-item>
        <el-form-item label="图纸">
            <el-upload
                    name="file"
                    :data="{_token: '{{csrf_token()}}'}"
                    action="/community/upload"
                    :on-success="function(r, f, l){return fileSuccess(r, f, l, 'thumb')}"
                    :on-preview="filePreview"
                    :on-remove="function(r, f, l){return fileRemove(f, l, 'thumb')}"
                    :file-list="form.thumb"
                    :limit="1"
                    :on-exceed="fileExceed"
                    list-type="picture">
                <el-button size="small" type="primary">点击上传</el-button>
                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过2M</div>
            </el-upload>
        </el-form-item>
    </el-form>
    <div style="width: 100%;height: 40px;"></div>
    <el-button type="primary"
               @click="communitySave"
               class="fix-button">保存</el-button>
@endsection

@section('js')
    <script src="/js/community/edit.js?v=201911172105"></script>
@endsection